<?
/**
 * 本文件用于与Redis服务器交互
 *
 * @author    徐鹏程 <xupengcheng@snda.com>
 */


class UCLibRedis {

	static private $_server = false;

	static function getServer() {
		if (self::$_server !== false) return self::$_server;

		require_once(dirname(__FILE__).'/../config/UCConfRedis.php');
		require_once(dirname(__FILE__).'/redis/redis.php');

		$config = UCConfRedis::getServer();

		if ($config) {
			self::$_server = new Redis($config[0], $config[1]);
		} else {
			self::$_server = null;
		}
		return self::$_server;
	}
}